<?php
require_once(__DIR__.'/../core/globalFunctions.php');
require_once(__DIR__.'/../core/eventSubscriber.php');

// This is the user class. It handles the session.
class User {
	function __construct ($name) {
		// Get session if there's a sessionvar.
		if (isset($_COOKIE["TOKEN"]) && isset($_COOKIE["AUTHKEY"])) {
			$this->usrid = getDB()->authoriseSession($_COOKIE["TOKEN"],$_SESSION["COOKIE"]);
		} else {
			$this->usrid = false;
		}
		
	}
	
	function loggedIn () {
		if ($this->usrid) {
			return true;
		} else {
			return false;
		}
	}
}
?>